From 36413a8eca48c74a0a2719035ceca1b097930d41 Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Sat, 21 Jan 2017 15:11:40 +0000 Subject: [PATCH] combobox: Reuse code rather than reimplementing it We already have cell_layout_is_sensitive() to get whether at least one cell in a Layout is sensitive, which we need because CellLayout/View do not implement foreach(). So, since we wrote that, we can use it to check our CellArea too, instead of doing foreach with a custom callback. --- gtk/gtkcombobox.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 471e419bb3..bb41e5e4c7 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -1465,17 +1465,6 @@ cell_layout_is_sensitive (GtkCellLayout *layout) return sensitive; } -static gboolean -cell_is_sensitive (GtkCellRenderer *cell, - gpointer data) -{ - gboolean *sensitive = data; - - g_object_get (cell, "sensitive", sensitive, NULL); - - return *sensitive; -} - static gboolean tree_column_row_is_sensitive (GtkComboBox *combo_box, GtkTreeIter *iter) @@ -1489,20 +1478,8 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box, return FALSE; } - if (priv->area) - { - gboolean sensitive; - - gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE); - - sensitive = FALSE; - - gtk_cell_area_foreach (priv->area, cell_is_sensitive, &sensitive); - - return sensitive; - } - - return TRUE; + gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE); + return cell_layout_is_sensitive (GTK_CELL_LAYOUT (priv->area)); } static void -- 2.30.2